<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserDrugsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_drugs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')->default(0)->comment('用户id');
            $table->bigInteger('enterprise_id')->default(0)->comment('商家id');
            $table->string('patientName')->nullable()->default('')->comment('真实姓名');
            $table->tinyInteger('patientSex')->default(1)->comment('性别 1：男 2：女');
            $table->integer('patientAge')->default(0)->comment('年龄');
            $table->decimal('patientWeight')->default(0)->comment('体重（kg）');
            $table->string('patientPhone')->nullable()->default('')->comment('手机号');
            $table->string('patientIdcard')->nullable()->default('')->comment('身份证号');
            $table->timestamp('patientBirthday')->nullable()->comment('出生日期');
            $table->tinyInteger('relationship')->default(0)->comment('关系 0：本人 1：家属 2：亲戚 3：朋友');
            $table->string('patientAddress')->nullable()->default('')->comment('地址');
            $table->string('pmh')->nullable()->default('')->comment('过往病史');
            $table->string('amh')->nullable()->default('')->comment('过敏史');
            $table->string('fmh')->nullable()->default('')->comment('家族病史');
            $table->string('nurse')->nullable()->default('')->comment('妊娠哺乳');
            $table->string('liver')->nullable()->default('')->comment('肝功能');
            $table->string('renal')->nullable()->default('')->comment('肾功能');
            $table->tinyInteger('is_default')->default(0)->comment('是否默认 0：否 1：是');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_drugs');
    }
}
